package 模拟真题;

import java.util.Scanner;

/**
 * @author ShadowLim
 * @create 2022-03-24-20:45
 */
public class 插座 {
    static int n, m, r, c;
    static char[][] chaban, chatou;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n =scanner.nextInt();
        m = scanner.nextInt();
        chaban = new char[n][m];
        for (int i = 0; i < n; i++) {
            chaban[i] = scanner.next().toCharArray();
        }
        r = scanner.nextInt();
        c = scanner.nextInt();
        chatou = new char[r][c];
        for (int i = 0; i < r; i++) {
            chatou[i] = scanner.next().toCharArray();
        }
        scanner.close();
        // 特判（插头面积比插板大）
        if (r > n || c > m) {
            System.out.println("NO");
            return;
        }
        // 从小到大去枚举起始位置，找到的第一个符合的位置即为满足题目要求的答案
        for (int i = 0; i + r - 1 < n; i++) {   // 插头最下边界不得超过插板最下边界
            for (int j = 0; j + c - 1 < m; j++) {    // 插头最右边界不得超过插板最右边界
                if (check(i, j)) {
                    System.out.println((i + 1) + " " + (j + 1));
                    return;
                } else {
                }
            }
        }
        System.out.println("NO");
    }

    /**
     * 判断插板（x,y）位置能否插入插头
     * @param x
     * @param y
     * @return
     */
    private static boolean check(int x, int y) {
        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                if (chatou[i][j] == '1' && chaban[i + x][j + y] == '0') {
                    return false;
                }
            }
        }
        return true;
    }
}
